$(function(){
	//添加操作备注
	var $btnOrderLog = $('#btnOrderLog');
	
	$btnOrderLog.click(function(){
		orderLogAdd();
	});
	
});

//添加订单备注
function orderLogAdd(){
	
	var order_id = $('#order_id').val();
	var message = $.trim($('#message').val());
	
	var order_status	= $('input[name="order_status"]:checked').val();;
	var pay_status		= $('input[name="pay_status"]:checked').val();;
	var shipping_status	= $('input[name="shipping_status"]:checked').val();;
	
	if(message == ''){
		if(!confirm('没有填写备注，确认继续？')){
			return false;
		}
	}
	
	$('#message').val('');
	
	var params = {
		'order_id'			:order_id,
		'message'			:message,
		'order_status'		:order_status,
		'pay_status'		:pay_status,
		'shipping_status'	:shipping_status
	};
	$.post('/index.php/Admin/Order/order_log_add',params,function(data){
		
		if(data.success){
			alert('备注添加成功');
			
			var timestamp=new Date().getTime();
			$('#div-order_log').load('/index.php/Admin/Order/order_log?order_id=' + order_id + '&t=' + timestamp);
		}else{
			alert('备注添加失败');
			$('#message').val(message);
		}
		
	},'json');
}